<?php
/*
 * Included in login required pages.
 * Force user to login.
 *
 * (Make sure no content is printed before.)
 */
if (session_status() !== PHP_SESSION_ACTIVE) session_start();

if (!isset($_SESSION['user_id'])) {
    header("HTTP/1.1 302 Moved Temporarily");
    header("Location: /login.php");
    exit();
}
